import React, { Component } from "react";
import { context } from "./App";

class Child2 extends Component {
  render() {
    return (
      <>
        <div>child2组件</div>
        <context.Consumer>
          {(value) => (
            <>
              <button onClick={value.minus}>-</button>
              <span>{value.count}</span>
              <button onClick={value.add}>+</button>
            </>
          )}
        </context.Consumer>
      </>
    );
  }
}

export default Child2;
